package com.example.park2212.user

import androidx.lifecycle.MutableLiveData
import com.example.lib_base.entity.RegisterEntitResult
import com.example.lib_base.entity.UserEntityResult
import com.example.lib_base.mvvm.BaseViewModel
import com.example.lib_base.net.ApiService
import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject
@HiltViewModel
class UserViewModel @Inject constructor(val apiService: ApiService) : BaseViewModel() {

    var loginSuccess = MutableLiveData<UserEntityResult>()

    fun login(username:String,password:String){
        httpRequest({
            apiService.login(username,password)},{loginSuccess.value = it})
    }

    var registerSuccess = MutableLiveData<RegisterEntitResult>()
    fun register(username:String,password:String){
        httpRequest({apiService.register(username, password)},{registerSuccess.value = it})
    }


}